load("//bazel:defs.bzl", "compatible_with_rp2")

package(default_visibility = ["//visibility:public"])

cc_library(
    name = "pico_mbedtls_config",
    includes = ["include"],
    hdrs = ["include/pico_mbedtls_config.h"],
    defines = ['MBEDTLS_CONFIG_FILE=\\"pico_mbedtls_config.h\\"'],
)

cc_library(
    name = "pico_mbedtls",
    srcs = ["pico_mbedtls.c"],
    hdrs = ["include/sha256_alt.h"],
    includes = ["include"],
    target_compatible_with = compatible_with_rp2(),
    deps = [
        ":pico_mbedtls_library",
        ":pico_mbedtls_config",
        "//src/rp2_common:pico_platform",
        "//src/rp2_common/pico_rand",
    ] + select({
        "//bazel/constraint:rp2350": [ "//src/rp2_common/pico_sha256" ],
        "//conditions:default": [ ],
    }),
)

alias(
    name = "pico_mbedtls_library",
    actual = "@mbedtls//:pico_mbedtls_library",
)
